/*
 * @Descripttion: 
 * @version: 
 * @Author: wtzhang
 * @Date: 2021-06-02 13:08:52
 * @LastEditors: wtzhang
 * @LastEditTime: 2021-06-02 13:13:57
 */
// 引入依赖
const mongoose = require('mongoose')
// 连接数据库
mongoose.connect('mongodb://localhost:27017/Minblog', {
    useNewUrlParser: true,
    useUnifiedTopology: true
})
const db = mongoose.connection
db.on('error',console.error.bind(console,'connection error: '))
db.once('open',function () {
    console.log("数据库成功连接!!")
})
module.exports = db